#pragma once
#include"cocos2d.h"
#include"Box2D\Box2D.h"

class GLESDebugDraw;

#define createScene(_TYPE_)   \
static cocos2d::Scene * _TYPE_::createScenes()   \
{   \
	auto scene = cocos2d::Scene::create();   \
	auto node = _TYPE_::create();   \
	scene->addChild(node);   \
	return scene;   \
}

class AbstractBox2DTest : public cocos2d::Node
{
public:
	static AbstractBox2DTest* create(const b2Vec2& gravity);

	virtual bool init(const b2Vec2& gravity);

	void createBox2dApp(const b2Vec2& gravity);
	
	virtual void update(float dt) override;
	
	virtual void box2DAppReady();

	virtual void draw(cocos2d::Renderer *renderer, const cocos2d::Mat4& transform, uint32_t flags) override;
	
	void onExit() override;
protected:
	b2World * pWorld;
	GLESDebugDraw* pDebug;
};
